from utils.common import load_logging_config,dump_json
import logging
import os

def add_executor():
    name='local_service'
    ip='localhost'
    port='8085'
    executor_json={
        'name':name,
        'ip':ip,
        'port':port
    }
    if not f'{executor_json["name"]}.json' in os.listdir('jsons/executors'):
        dump_json(executor_json,f'jsons/executors/{executor_json["name"]}.json')
    else:
        logging.error('任务执行端信息json文件重名，请重命名')

if __name__=='__main__':
    load_logging_config()
    add_executor()